package com.enuo.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.enuo.utils.AjaxMsg;

/**
 * @ClassName: LoginController
 * @Description: TODO(Controller-admin)
 * @author Charles
 * @date 2017年11月16日 下午1:48:39
 * @version 1.0
 */
@RequestMapping("/admin")
@Controller
public class LoginController extends BaseController
{
    /**
     * @Title: login 
     * @Description: TODO(登陆) 
     * @param @param request
     * @param @param response
     * @param @return 设定文件 
     * @return String 返回类型  
     * @throws
     */
    @RequestMapping(value = "/login")
    @ResponseBody
    public String login(HttpServletRequest request, HttpServletResponse response)
    {
        Subject subject = SecurityUtils.getSubject();
        System.out.println("是否登录" + subject.isAuthenticated());
        return AjaxMsg.success("登录");
    }

    /**
     * @Title: unauthorized 
     * @Description: TODO(未经过授权) 
     * @param @return 设定文件 
     * @return String 返回类型  
     * @throws
     */
    @RequestMapping(value = "/unauthorized")
    @ResponseBody
    public String unauthorized()
    {
        return AjaxMsg.success("权限不足");
    }
    
    /**
     * @Title: success 
     * @Description: TODO(成功) 
     * @param @return 设定文件 
     * @return String 返回类型  
     * @throws
     */
    @RequestMapping(value = "/success")
    @ResponseBody
    public String success()
    {
        return AjaxMsg.success("进入成功页面");
    }
}
